<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>忘记密码</title>
<link rel="stylesheet" href="../../resource/css/global.css" />
<link rel="stylesheet"  href="../../resource/css/login.css"/>
<link rel="stylesheet" href="../../resource/css/userCenter.css" />
<link rel="stylesheet" href="../../resource/css/validation.css" />

<script src="../../resource/js/template.js"></script>
<script src="../../resource/js/jquery-1.8.0.js"></script>
<script src="../../resource/js/result.js"></script>
 <script src="../../resource/js/md5.js"></script>
<!-- 表单验证 -->
<script src="../../resource/js/jquery.validate2.js"></script>
<script type="text/javascript" src="../../resource/layui/layer.js"></script>
<style type="text/css">
body {
	background-color: #FFFFFF;
}
</style>

<script type="text/javascript">

	$(function() {
		$("#mForm").validate({
			rules : {
				phone : {
					required : true,
					phoneCheck : true
				},
				code : {
					required : true
				},
				password : {
					required : true,
					rangelength : [ 6, 20 ],
					passRule : true
				},
				repassword : {
					equalTo : "#password"
				}
			},
			messages : {
				phone : {
					required : "请输入手机号"
				},
				code : {
					required : "请输入验证码"
				},
				password : {
					required : "请输入密码",
					rangelength : "长度不符合要求"
				},
				repassword : {
					equalTo : "两次密码输入不一致"
				}
			},
			submitHandler : function(form) { //通过之后回调 
				sub();
			},
			invalidHandler : function(form, validator) { //不通过回调 
				return false;
			}
		});
	})
</script>
</head>

<body>
<!--header Begin-->
<div class="header">
	<div class="topCon">
        <h1 class="logo">大拇指用户中心-停车一道通，智慧让生活更轻松</h1>
        <div class="service">
            <ul>
                <li>
                    <a href="/ydtu/page/custom/helpCenter_list.html"><img src="../../resource/images/icn_10.png" />常见问题</a>
                </li>
                <li>
                    <a href=""><img src="../../resource/images/icn_11.png"  />投诉建议</a>
                </li>
                <li>
                    <a href=""><img src="../../resource/images/icn_12.png"  />在线客服</a>
                </li>
            </ul> 
        </div>
        <div class="uploader">
            <a href="#"><img src="../../resource/images/icon_10.gif" />下载停车一道通APP，生活更轻松！</a>
        </div>
        <div class="cl"></div>
     
    </div>
</div>
<!--header End-->
<!--mainContent Begin-->
<form id="mForm"  method="post">
<div class="mainContent"  id="main1">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tbody>
		<tr>
        	<td height="50" bgcolor="#FFFFFF">
	        	<div class="Usuallypark2 bor01">
				<h2><span>忘记密码</span><a href="/ydtu/page/custom/login.html">已有账户？马上登录</a></h2>
				<ul>
	             <!------------内容主体部分 Start-------------->
				<div id="Content_box">
					<div class="main_content main_find_password">
						<div class="main_insq find_password_title">
	  						<div class="find_passwerd_box">
	  							<table width="100%" border="0" cellpadding=0 cellspacing=0 >
									<tr>
										<td height="80" colspan="3"  >
								      	<div class="rech_process2" >
								  			<div class="itm_bg">
								    			<div class="yuan_bg yuan_bg_1  color_e2">1</div>
								    			<div class="yuan_bg yuan_bg_2">2</div>
								    			<div class="yuan_bg yuan_bg_3">3</div>
								    			<div class="text text_1  color_e2">验证身份</div>
								    			<div class="text text_2">设置新密码</div>
								    			<div class="text text_3">完成</div>
								  			</div>
								  		</div>
								  		</td>
							      	</tr>
	  								<tr>
									    <td width="88"  class="left_td"><p>手机号：</p></td>
									    <td width="276"  ><samp class="Check_code2_box"><input type="text" name="phone" class="check_code2" id="Check_code" maxlength="15"/><a href="javascript:void(0);" id="J_BtnMobileCode"><span id="fff">获取验证码</span></a> </samp>
									     <label id="msg" for="Check_code" class="tip" tip="请输入手机号码"></label>
									    </td>
<!-- 									    <td width="176" id="msg" style="color:red"></td> -->
									   
								    </tr>
								    <tr>
								      	<td  class="left_td"><p>手机验证码：</p></td>
								      	<td><input type="text" name="code" class="input_sytle" id="code" maxlength="6"/>
								      	<label id="cmsg" for="code" class="tip" tip="请输入验证码"></label>
								      	</td>
<!-- 								      	<td width="176" id="cmsg" style="color:red"></td> -->
								     </tr> 
								    <tr>
								      	<td>&nbsp;</td>
								      	<td><input type="button" name="input_login"  style="width:262px;" value="下一步" class="input_border input_login" id="Input_login"/></td>
								      	<td>&nbsp;</td>
								    </tr>
	  							</table>
							</div>
						</div>
					</div>
				</div>
				<!------------内容主体部分 End-------------->
				</ul>
				</div>
       		 </td>
      	</tr>
      	<tr>
        	<td bgcolor="#FFFFFF">
        	</td>
      	</tr>
		</tbody>
	</table>
</div>
<!--mainContent End-->



<!--mainContent Begin-->
<div class="mainContent" style="display:none;" id="main2">
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tbody>
		<tr>
        	<td height="50" bgcolor="#FFFFFF">
	        	<div class="Usuallypark2 bor01">
				<h2><span>忘记密码</span><a href="/ydtu/page/custom/login.html">已有账户？马上登录</a></h2>
				<ul>
	             <!------------内容主体部分 Start-------------->
				<div id="Content_box">
					<div class="main_content main_find_password">
						<div class="main_insq find_password_title">
	  						<div class="find_passwerd_box">
	  							<input type="hidden" name="type" value="3">
	  							<input type="hidden" name="cellphone" id="cellphone">
	  							<table width="100%" border="0" cellpadding=0 cellspacing=0 >
									<tr>
										<td height="80" colspan="3"  >
								      	<div class="rech_process2" >
								  			<div class="itm_bg">
								    			<div class="yuan_bg yuan_bg_1  color_e2">1</div>
								    			<div class="yuan_bg yuan_bg_2">2</div>
								    			<div class="yuan_bg yuan_bg_3">3</div>
								    			<div class="text text_1">验证身份</div>
								    			<div class="text text_2  color_e2">设置新密码</div>
								    			<div class="text text_3">完成</div>
								  			</div>
								  		</div>
								  		</td>
							      	</tr>
								 	<tr>
								      	<td width="112"  class="left_td">&nbsp;</td>
								      	<td width="409"  >&nbsp;</td>
								      	<td width="19"  ></td>
								    </tr> 
								    <tr>
								      	<td width="112"  class="left_td"><p>新密码：</p></td>
								      	<td width="409"  ><input type="password" name="password" class="input_sytle"  id="password"/>
								      	<label for="password" class="tip" tip="密码由6-20位字母、数字组合"></label>
								      	</td>
								    </tr> 
								    <tr>
								       	<td class="left_td"><p>确认新密码：</p></td>
								       	<td><input type="password" name="repassword" class="input_sytle"/>
								       	<label for="repassword" class="tip" tip="请再次输入密码"></label>
								       	</td>
								    </tr> 
								    <tr>
								      	<td>&nbsp;</td>
								      	<td><input type="submit" name="input_login"  style="width:262px;" value="下一步" class="input_border input_login"/></td>
								      	<td>&nbsp;</td>
								    </tr>
	  							</table>
							</div>
						</div>
					</div>
				</div>
				<!------------内容主体部分 End-------------->
				</ul>
				</div>
       		 </td>
      	</tr>
      	<tr>
        	<td bgcolor="#FFFFFF">
        	</td>
      	</tr>
		</tbody>
	</table>
</div>
</form>
<!--mainContent End-->

<!--foot Begin-->
<div id="foot_sidebar"></div>
<script>
$("#foot_sidebar").load("foot.html"); 
</script>
<!--foot End-->

<script>

function phoneReg(){
	var val = $("#Check_code").val();
	if(val.trim()==""){
		$("#msg").text("请输入手机号").addClass("error1").show();
		return;
	}
	var re =/^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/; 
	if (!re.test(val)||val.length!=11) {
	    return false;
	}else{
		return true;
	}
}


$("#J_BtnMobileCode").click(function(){
	if(!phoneReg()){
		return false;
	}
	if(vcode_status==0){
		$.ajax({ 
		    type:"POST",
		    url:'/ydtu/tmember/getCode.htm',
			data : {
	  			"codeType" : 1,
	  			"phone" : $("#Check_code").val()
			},
			dataType : 'json',
			success : function(data) {
				checkResult(data.result);
				if(data.result == 'FAIL'){
 					$("#msg").text("该号码非注册会员").addClass("error1").removeClass("valid").show();
					return false;
				}else{
					settime();
				}
			}
		}); 
	}
});
var vcode_status=0;
var countdown = 60;

function settime() {
	countdown--;
	if(countdown <= 0){
		vcode_status=0;
		$("#fff").text("获取验证码"); 
		countdown = 60;
	}else {
		setTimeout(settime, 1000);
		vcode_status=1;
		$("#fff").text(countdown+"秒"); 
	}
}

function sub(){
	$.ajax({
		type: "post",
		url: "/ydtu/tmember/resetPassword.htm",
		data: {"cellphone":$("#Check_code").val(),"password":hex_md5($("#password").val())},
		dataType: "json",
		success: function(data){
			checkResult(data.result);
			if(data.result == SUCCESS){
				layer.alert("修改成功");
				setTimeout(function(){
					location.href="/ydtu/page/custom/login.html";
				}, 2000 )
				
			}		
		}
	})
}
$("#Input_login").click(function(){
	$.ajax({
		type:"POST",
		url:'/ydtu/tmember/validate_code.htm',
		data : {
  			"code" : $("#code").val(),
  			"phone" : $("#Check_code").val()
		},
		dataType : 'json',
		async:false,
		success : function(data) {
			checkResult(data.result);
			if (data.result == "FAIL") {
				$("#cmsg").text("验证码错误").addClass("error1").show();
				return;
			}else{
				var phone = $("#Check_code").val();
				$("#main1").css("display", "none");
				$("#main2").css("display", "block");
				$("#cellphone").val(phone);
			}
		}					
	});

})

</script>
</body>
</html>
